<template>
  <div class="tabs">
    <div class="list">
      <span
        :class="{ active: $route.path.indexOf('menu') !== -1 }"
        @click="itemClick('/shop/menu')"
        >点餐</span
      >
      <span
        :class="{ active: $route.path.indexOf('comment') !== -1 }"
        @click="itemClick('/shop/comment')"
        >评价</span
      >
      <span
        :class="{ active: $route.path.indexOf('detail') !== -1 }"
        @click="itemClick('/shop/detail')"
        >商家</span
      >
    </div>
    <div class="search">
      <i class="iconfont icon-sousuo"></i>
      <input type="text" value="搜索" />
    </div>
  </div>
</template>

<script>
export default {
  props: {
    shopId: Number
  },
  data() {
    return {};
  },
  methods: {
    itemClick(path) {
      this.$router.replace({
        path,
        query: {
          shopId: this.shopId
        }
      });
    }
  }
};
</script>

<style lang="less" scoped>
.tabs {
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background-color: #fff;
  span {
    margin-right: 15px;
    padding: 2px 0;
    font-size: var(--font-size);
    border-bottom: 2px solid #fff;
  }
  .search {
    position: relative;
    font-size: var(--font-min);
    color: #333;
    input {
      width: 55px;
      height: 20px;
      line-height: 20px;
      text-indent: 23px;
      border-radius: 10px;
      background-color: #f5f5f5;
    }
    i {
      position: absolute;
      top: 2px;
      left: 5px;
      font-size: 14px;
    }
  }
  .active {
    color: #222;
    border-color: var(--color-base);
  }
}
</style>
